home *** CD-ROM | disk | FTP | other *** search
/ Holt Researcher: American History / Holt Researcher: American History.iso / pc / modules / dbmap.dxr / 00006_Platforn, File io.ls < prev    next >
Encoding:
Text File  |  2000-01-27  |  1.4 KB  |  71 lines

  1. global mnew, mReadFile, mdispose
  2.  
  3. on GetTextExtension
  4.   return ".txt"
  5. end
  6.  
  7. on GetArtExtension
  8.   if the machineType = 256 then
  9.     Extension = ".bmp"
  10.   else
  11.     Extension = ".pict"
  12.   end if
  13.   return Extension
  14. end
  15.  
  16. on GetSavePathandName xName
  17.   unLoad()
  18.   FileioObj = new(xtra("fileio"))
  19.   if not objectp(FileioObj) then
  20.     beep()
  21.   else
  22.     pathAndName = displaySave(FileioObj, "Where would you like to save?", xName)
  23.     FileioObj = 0
  24.     return pathAndName
  25.   end if
  26. end
  27.  
  28. on EvalStripExtension pathAndName
  29.   if the machineType = 256 then
  30.     savedDelimiter = the itemDelimiter
  31.     the itemDelimiter = "\"
  32.     ItemCount = the number of items in pathAndName
  33.     fileName = item ItemCount of pathAndName
  34.     CharNum = offset(".", fileName)
  35.     if CharNum > 0 then
  36.       fileName = char 1 to CharNum - 1 of fileName
  37.     end if
  38.     put fileName into item ItemCount of pathAndName
  39.     the itemDelimiter = savedDelimiter
  40.     return pathAndName
  41.   else
  42.     return pathAndName
  43.   end if
  44. end
  45.  
  46. on IsKeyBoardEquivalentDown
  47.   if the machineType = 256 then
  48.     return the controlDown
  49.   else
  50.     return the commandDown
  51.   end if
  52. end
  53.  
  54. on readFile xFile
  55.   FileioObj = fileio(mnew, "read", xFile)
  56.   if objectp(FileioObj) then
  57.     xText = FileioObj(mReadFile)
  58.     FileioObj(mdispose)
  59.   end if
  60.   return xText
  61. end
  62.  
  63. on GetTextFilePath
  64.   if the machineType = 256 then
  65.     xPath = the pathName & "textdata\"
  66.   else
  67.     xPath = the pathName & "textdata:"
  68.   end if
  69.   return xPath
  70. end
  71.